package com.by.biz.impl;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import com.by.biz.UsersBiz;
import com.by.dao.UsersDao;
import com.by.entity.Users;
import com.by.util.Page;

@Service
public class UsersBizImpl implements UsersBiz{
	@Resource
	private	UsersDao usersDao;

	public Users login(Users users) {
		return usersDao.findByName(users.getName());
	}

	public int update(Users users) {
		return usersDao.update(users);
	}

	public Page<Users> findPage(Page<Users> page) {
		int total = usersDao.countByCon(page.getCon());
		
		page.setTotal(total);
		List<Users>	list = usersDao
							.findPageByCon(page.getCon(), 
											page.getOffset(), 
											page.getPageSize());
		page.setList(list);
		
		return page;
	}

}












